#ifndef _protocol_h
#define _protocol_h	 	
	
	
////////////////////////////自定义通讯函数///////////利用宏定义/////////////////////////
    #define MAKE_A_Protocol(name,type) \
    extern unsigned short int name##RX_STA=0;\
    extern type name##RX_STA_FLAG=0;\
    extern type name##RX_BUF[1024]={0};\
    extern type name##TX_BUF[1024]={0};\
    extern type name##start_sign=0;\
    extern type name##end_sign1=0;\
    extern type name##end_sign2=0;\
    extern type name##receive=0;\
    extern type name##RX_REC_ATCOMMAD=0;\
    extern void name##SetProtocol(u8 r,u8 start_sign,u8 end_sign1,u8 end_sign2 ){\
    if((name##RX_STA&0x8000)==0)\
    {\
    if(name##RX_STA&0x4000)\
    {\
    if(r!=end_sign2){name##RX_STA=0;name##RX_STA_FLAG=0;}\
    else {name##RX_STA=0;name##RX_STA_FLAG=0;}\
    }\
    else\
    {\
    if(r==end_sign1)name##RX_STA|=0x4000;\
    else\
    {\
    if(r==start_sign)name##RX_STA_FLAG=1;\
    else{\
    if(name##RX_STA_FLAG==1)\
    {\
    name##RX_BUF[name##RX_STA&0X3FFF]=r ;\
    name##RX_STA++;\
    if(name##RX_STA>(3000-1)){name##RX_STA=0;name##RX_STA_FLAG=0;	}\
    }}}}}}			
#endif